From: Keir Fraser Date: Thu, 17 Dec 2009 06:27:56 +0000 (+0000) Subject: HAP fault handling for shared pages. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~12858 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=29317cfbf36d6a7f3088da50db1e84412c47626b;p=xen.git HAP fault handling for shared pages. Signed-off-by: Grzegorz Milos --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index e18e94f349..3109a6df03 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -960,6 +960,13 @@ bool_t hvm_hap_nested_page_fault(unsigned long gfn) return 1; } + /* Mem sharing: unshare the page and try again */ + if ( p2mt == p2m_ram_shared ) + { + mem_sharing_unshare_page(current->domain, gfn, 0); + return 1; + } + /* Shouldn't happen: Maybe the guest was writing to a r/o grant mapping? */ if ( p2mt == p2m_grant_map_ro ) { diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index 4cb4d01c5a..53697b3761 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 4c7d63d94e..330cf7c31e 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include diff --git a/xen/arch/x86/mm/hap/p2m-ept.c b/xen/arch/x86/mm/hap/p2m-ept.c index f8bffff1c3..a7f8db4186 100644 --- a/xen/arch/x86/mm/hap/p2m-ept.c +++ b/xen/arch/x86/mm/hap/p2m-ept.c @@ -71,6 +71,7 @@ static void ept_p2m_type_to_flags(ept_entry_t *entry, p2m_type_t type) return; case p2m_ram_logdirty: case p2m_ram_ro: + case p2m_ram_shared: entry->r = entry->x = 1; entry->w = 0; return; diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 8f575d088f..ab74323f4a 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -92,6 +92,8 @@ static unsigned long p2m_type_to_flags(p2m_type_t t) case p2m_ram_ro: case p2m_grant_map_ro: return flags | P2M_BASE_FLAGS; + case p2m_ram_shared: + return flags | P2M_BASE_FLAGS; case p2m_mmio_dm: return flags; case p2m_mmio_direct: